<?php

namespace IMOcean\Tests;

class Timer
{
    public static function handle()
    {

        $tickTimerId = \Swoole\Timer::tick(1000, function (int $timerId, string $parameter) {
            echo "timer id: {$timerId}, parameter: {$parameter}" . PHP_EOL;
        }, 'tick');

        var_dump($tickTimerId);

        var_dump(\Swoole\Timer::info($tickTimerId));

        \Swoole\Timer::after(3000, function (int $timerId) {
            echo "execute-after: stop tick id: {$timerId}" . PHP_EOL;

            \Swoole\Timer::clear($timerId);
        }, $tickTimerId);

        var_dump(\Swoole\Timer::clearAll());

        var_dump(\Swoole\Timer::list());

        var_dump(\Swoole\Timer::stats());
    }
}
